The invention is directed generally to data processing apparatus having some form of parallel or pipelined architecture, and including floating point computations, and more particularly to a method and apparatus for handling precise floating point exceptions in such pipelined architecture.
Computing apparatus today, particularly those for scientific and engineering uses, more often than not perform computations with "floating point" numbers. One advantage of floating point numbers is that they allow computations where the range of the magnitude of the numbers is very large, larger than can be handled, for example, with fixed point numbers except with great difficulty. Floating point representation of numbers corresponds very closely to what is often termed "scientific notation," each being represented as the product of a normal number with a radix point and an integral power of the radix. Thus, for example, a number might be represented as: EQU 6318.times. 10.sup.2.
The number, 6318, is called the "fractional" part, and the 2 is called the "exponent" part. In digital representation: EQU .0.0.0.0.11.0..0..0.1.0.1.0.111.0.
where the most significant bit is the sign, the next three bits form the exponent field, and the remaining bits form the fraction field.
While floating point numbers and floating point computation provide significant advantages over fixed point numbers and computations, they are not without certain problems. One such problem may occur when the magnitude of the result of a floating point computation exceeds or "overflows" the capacity of the floating point number system. This problem, conventionally referred to as a floating point "exception," requires special handling when discovered (such as the setting of an indicator that a programmer can test to stop the computation with an appropriate error message).
Other exceptions include "underflow," which results from the attempt to produce a non-zero result too small (in magnitude) to be accommodated; or an "inexact" exception in which, because of the results size, rounding must be accomplished creating possible inaccuracies.
There exist today many methods and techniques for handling a floating point exception, when it occurs, all of which are well known. However, particular problems arise when floating point computations are used in data processing systems capable of some form of parallel processing such as is found in pipelined architecture. Pipelined architecture usually encompasses processor designs in which multiple instructions are in various stages of execution, all at the same time. When a floating point instruction culminates in a floating point exception, the special handling necessary requires that the floating point instruction be re-executed, but only after the operands are adjusted to avoid the exception occurring again. However, to re-execute the floating point instruction, the data processing apparatus must be "backed up," so to speak, which means that the results of any instructions executed, or partially executed, during the execution of the floating point instruction must be saved until later, or thrown away. This, in turn, requires the "state" of the data processing apparatus to be returned to that originally encountered by the instruction.
The problem is exacerbated when different instructions require different execution times; that is, when certain instructions can be executed in two, four, or a small number of processor cycles of operation, whereas other instructions, particularly floating point instructions, require many more processor cycles of operation to completion. In this case, a floating point computation that results in an exception is much more difficult to "back out" of. That is, it is much more difficult to restore the state of the data processing apparatus to that originally encountered by the instruction in order to avoid the float-point exception.
One obvious solution to these problems would be to halt the processing of any subsequent instruction when a floating point computation is first encountered, allowing only the floating point computation to proceed. A check of the result can then be made to determine if an exception has occurred. If not, normal processing resumes; if an exception has occurred, the computation can be redone without having to "flush" the pipeline (i.e., to discard or store the results of the pipeline insofar as instructions following the floating point instruction are concerned). This scheme, however, can significantly affect the performance of the data processing system.